<?php
namespace App\Http\Controllers\Admin;

use App\Models\UserScoreStream;
use App\Models\UserCharge;
/**
 *
 * @author Joker
 * 用户消费记录
 *        
 */
class UserConsumeController extends BaseController
{
    public function index()
    {
        if(!$this->user->can('viewUserConsume')) abort(405);
        
        $consume = UserScoreStream::where('type','=',1)->orderBy('created_at','desc')->orderBy('id','desc')->paginate(20);
        return view('admin.users.stream')->with('result',$consume)->with('tabs','消费记录')->with('tream','金币值');
    }
    
    public function charge()
    {
        if(!$this->user->can('viewUserCharge')) abort(405);
        
        $charge = UserCharge::orderBy('created_at','desc')->orderBy('id','desc')->paginate(20);
        return view('admin.users.charge')->with('result',$charge);
    }
    
    public function jifen()
    {
        if(!$this->user->can('deleteUserPoint')) abort(405);
        
        $scoreStream = UserScoreStream::where('type','=',0)->orderBy('created_at','desc')->orderBy('id','desc')->paginate(20);
        return view('admin.users.stream')->with('result',$scoreStream)->with('tabs','积分流水')->with('tream','积分值');
    }
}